<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户信息测试</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <div class="container mt-5">
        <div class="row justify-content-center">
            <div class="col-md-6">
                <div class="card">
                    <div class="card-header">
                        <h4 class="mb-0">当前登录用户信息</h4>
                    </div>
                    <div class="card-body">
                        <div th:if="${session.currentUser != null}">
                            <table class="table table-borderless">
                                <tr>
                                    <td><strong>用户名:</strong></td>
                                    <td th:text="${session.currentUser.username}"></td>
                                </tr>
                                <tr>
                                    <td><strong>真实姓名:</strong></td>
                                    <td th:text="${session.currentUser.realName}"></td>
                                </tr>
                                <tr>
                                    <td><strong>邮箱:</strong></td>
                                    <td th:text="${session.currentUser.email}"></td>
                                </tr>
                                <tr>
                                    <td><strong>角色:</strong></td>
                                    <td th:text="${session.currentUser.role}" 
                                        th:classappend="${session.currentUser.role == 'ADMIN' ? 'text-danger fw-bold' : 'text-secondary'}"></td>
                                </tr>
                                <tr>
                                    <td><strong>是否为管理员:</strong></td>
                                    <td th:text="${session.currentUser.role == 'ADMIN' ? '是' : '否'}" 
                                        th:classappend="${session.currentUser.role == 'ADMIN' ? 'text-success fw-bold' : 'text-danger'}"></td>
                                </tr>
                            </table>
                            <div class="alert alert-info mt-3">
                                <strong>提示:</strong> 只有管理员角色才能访问操作日志页面。
                            </div>
                            <div class="d-flex justify-content-between mt-4">
                                <a href="/dashboard" class="btn btn-secondary">返回仪表盘</a>
                                <a href="/logout" class="btn btn-danger">退出登录</a>
                            </div>
                        </div>
                        <div th:if="${session.currentUser == null}">
                            <div class="alert alert-warning">
                                您尚未登录，请先<a href="/login">登录</a>。
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>